/*
 *  $Id: SpiritualChange.cs 1051 2010-05-18 22:10:41Z thenn.erannor $
 *	This file is a part of Ragima CCG.
 *	(C) 2008 Ragima development group.
 *
 *	Licensed under the terms of the GNU GPL License version 2.
 *
 */

namespace Ragima.Cards001.Air.Spells {
    public class SpiritualChange: TargetEnchantmentCard<Creature> {
        public SpiritualChange(): base("001_a_s_spiritual_change") {
            Level = CompleteLevel.ReadyForTest;
            Element = ElementType.Air;
            Value = 100;
            Target = CreatureTarget.Both;
            AddManaCost(ElementType.Air, 2);
        }

        protected override EnchantmentAffect CreateEnchantment() {
            return new SpiritualChangeAffect();
        }

        private class SpiritualChangeAffect: EnchantmentAffect<SpiritualChange> {
            public override void SetAffect() {
                base.SetAffect();
                DoExchange();
            }
            public override void ResetAffect() {
                base.ResetAffect();
                DoExchange();
            }

            private void DoExchange() {
                Creature owner = Owner as Creature;
                if (owner != null) owner.ExchangeDamageAndHealth();
            }
        }
    }
}
